HAL LPTIM constants migration

This section provides information about the HAL LPTIM constants migration .

HAL LPTIM active edge detection options constants

HAL1

HAL2



#define LPTIM_ACTIVEEDGE_RISING
#define LPTIM_ACTIVEEDGE_FALLING
#define LPTIM_ACTIVEEDGE_RISING_FALLING
typedef enum
{
  HAL_LPTIM_TRIG_RISING,
  HAL_LPTIM_TRIG_FALLING,
  HAL_LPTIM_TRIG_RISING_FALLING,
} hal_lptim_ext_trig_polarity_t;

Related concepts:


HAL LPTIM channel identifiers constants

HAL1

HAL2



#define LPTIM_CHANNEL_1
#define LPTIM_CHANNEL_2
typedef enum
{
  HAL_LPTIM_CHANNEL_1
  HAL_LPTIM_CHANNEL_2
} hal_lptim_channel_t;

Related concepts:


HAL LPTIM clock polarity options constants

HAL1

HAL2



#define LPTIM_CLOCKPOLARITY_RISING
#define LPTIM_CLOCKPOLARITY_FALLING
#define LPTIM_CLOCKPOLARITY_RISING_FALLING
typedef enum
{
  HAL_LPTIM_INPUT1_RISING
  HAL_LPTIM_INPUT1_FALLING
  HAL_LPTIM_INPUT1_RISING_FALLING
} hal_lptim_input1_polarity_t;

Related concepts:


HAL LPTIM DMA identifiers and update flags constants

HAL1

HAL2



#define LPTIM_DMA_ID_UPDATE
#define LPTIM_DMA_ID_CC1
#define LPTIM_DMA_ID_CC2
typedef enum
{
  HAL_LPTIM_DMA_ID_UPDATE
  HAL_LPTIM_DMA_ID_CC1
  HAL_LPTIM_DMA_ID_CC2
} hal_lptim_dma_index_t;

Related concepts :


HAL LPTIM input capture source options constants

This table lists the input capture sources available in HAL1 and their equivalents in HAL2.

  • In HAL1, there is a set of defines to specify both the input channel (IC1,IC2) and its source (e.g., GPIO, COMP1, COMP2, etc.).

  • In HAL2, these defines are replaced by the hal_lptim_ic_src_t enumeration, which specifies only the source. The channel selection is now passed as a parameter to the HAL_LPTIM_IC_SetConfigChannel function.

HAL1

HAL2



#define LPTIM_IC1SOURCE_GPIO
#define LPTIM_IC1SOURCE_COMP1
#define LPTIM_IC1SOURCE_COMP2
#define LPTIM_IC1SOURCE_EVENTOUT
#define LPTIM_IC1SOURCE_MCO1
#define LPTIM_IC1SOURCE_MCO2
#define LPTIM_IC2SOURCE_CSI_128
#define LPTIM_IC2SOURCE_GPIO
#define LPTIM_IC2SOURCE_HSE_1M
#define LPTIM_IC2SOURCE_HSI_1024
#define LPTIM_IC2SOURCE_HSI_256
#define LPTIM_IC2SOURCE_HSI_8
#define LPTIM_IC2SOURCE_LSE
#define LPTIM_IC2SOURCE_LSI
#define LPTIM_IC2SOURCE_MSIS_1024
#define LPTIM_IC2SOURCE_MSIS_4
typedef enum
{
  HAL_LPTIM_INPUT_GPIO
  HAL_LPTIM_INPUT_COMP1
  HAL_LPTIM_INPUT_COMP2
  HAL_LPTIM_INPUT_EVENTOUT
  HAL_LPTIM_INPUT_MCO1
  HAL_LPTIM_INPUT_MCO2
  HAL_LPTIM_INPUT_CSI_128

  HAL_LPTIM_INPUT_RCC_HSE_1MHZ
  HAL_LPTIM_INPUT_HSI_1024
  HAL_LPTIM_INPUT_HSI_256
  HAL_LPTIM_INPUT_HSI_8
  HAL_LPTIM_INPUT_LSE
  HAL_LPTIM_INPUT_LSI
  HAL_LPTIM_INPUT_MSIS_1024
  HAL_LPTIM_INPUT_MSIS_4
} hal_lptim_ic_src_t;

Related concepts:


HAL LPTIM input capture filter clock division constants

HAL1

HAL2



#define LPTIM_ICFLT_CLOCK_DIV1
#define LPTIM_ICFLT_CLOCK_DIV2
#define LPTIM_ICFLT_CLOCK_DIV4
#define LPTIM_ICFLT_CLOCK_DIV8
typedef enum
{
  HAL_LPTIM_FDIV1
  HAL_LPTIM_FDIV1_N2
  HAL_LPTIM_FDIV1_N4
  HAL_LPTIM_FDIV1_N8
} hal_lptim_filter_t;

Related concepts:


HAL LPTIM input capture polarity options constants

HAL1

HAL2



#define LPTIM_ICPOLARITY_FALLING
#define LPTIM_ICPOLARITY_RISING
#define LPTIM_ICPOLARITY_RISING_FALLING
typedef enum
{
  HAL_LPTIM_IC_RISING
  HAL_LPTIM_IC_FALLING
  HAL_LPTIM_IC_RISING_FALLING
} hal_lptim_ic_polarity_t;

Related concepts:


HAL LPTIM input capture prescaler division constants

HAL1

HAL2



#define LPTIM_ICPSC_DIV1
#define LPTIM_ICPSC_DIV2
#define LPTIM_ICPSC_DIV4
#define LPTIM_ICPSC_DIV8
typedef enum
{
  HAL_LPTIM_IC_DIV1
  HAL_LPTIM_IC_DIV2
  HAL_LPTIM_IC_DIV4
  HAL_LPTIM_IC_DIV8
} hal_lptim_ic_prescaler_t;

Related concepts:


HAL LPTIM input 1 source options constants

HAL1

HAL2



#define LPTIM_INPUT1SOURCE_GPIO
#define LPTIM_INPUT1SOURCE_COMP1
#define LPTIM_INPUT1SOURCE_COMP1_COMP2
#define LPTIM_INPUT1SOURCE_COMP2
#define LPTIM_INPUT1SOURCE_COMP3
#define LPTIM_INPUT1SOURCE_COMP5
#define LPTIM_INPUT1SOURCE_COMP7
#define LPTIM_INPUT1SOURCE_LPTIM1_CH2
#define LPTIM_INPUT1SOURCE_LPTIM2_CH1
#define LPTIM_INPUT1SOURCE_NOT_CONNECTED
#define LPTIM_INPUT1SOURCE_SAI4_FSA
#define LPTIM_INPUT1SOURCE_SAI4_FSB
typedef enum
{
  HAL_LPTIM_INPUT1_GPIO
  HAL_LPTIM_INPUT1_COMP1_OUT
  HAL_LPTIM_INPUT1_COMP1_COMP2
  HAL_LPTIM_INPUT1_COMP2_OUT
  HAL_LPTIM_INPUT1_COMP3_OUT
  HAL_LPTIM_INPUT1_COMP5_OUT
  HAL_LPTIM_INPUT1_COMP7_OUT
  HAL_LPTIM_INPUT1_LPTIM1_CH2
  HAL_LPTIM_INPUT1_LPTIM2_CH1
  HAL_LPTIM_INPUT1_NOT_CONNECTED
  HAL_LPTIM_INPUT1_SAI4_FSA
  HAL_LPTIM_INPUT1_SAI4_FSB
} hal_lptim_input1_src_t;

Related concepts:


HAL LPTIM input 2 source options constants

HAL1

HAL2



#define LPTIM_INPUT2SOURCE_GPIO
#define LPTIM_INPUT2SOURCE_COMP2
#define LPTIM_INPUT2SOURCE_COMP4
#define LPTIM_INPUT2SOURCE_COMP6
typedef enum
{
  HAL_LPTIM_INPUT2_GPIO
  HAL_LPTIM_INPUT2_COMP2_OUT
  HAL_LPTIM_INPUT2_COMP4_OUT
  HAL_LPTIM_INPUT2_COMP6_OUT
} hal_lptim_input2_src_t;

Related concepts:


HAL LPTIM output compare polarity options constants

HAL1

HAL2



#define LPTIM_OCPOLARITY_HIGH
#define LPTIM_OCPOLARITY_LOW
typedef enum
{
  HAL_LPTIM_OC_HIGH
  HAL_LPTIM_OC_LOW
} hal_lptim_oc_polarity_t;

Related concepts:


HAL LPTIM output polarity options constants

HAL1

HAL2



#define LPTIM_OUTPUTPOLARITY_HIGH
#define LPTIM_OUTPUTPOLARITY_LOW
typedef enum
{
  HAL_LPTIM_OC_HIGH
  HAL_LPTIM_OC_LOW
} hal_lptim_oc_polarity_t;

Related concepts:


HAL LPTIM prescaler division values constants

HAL1

HAL2



#define LPTIM_PRESCALER_DIV1
#define LPTIM_PRESCALER_DIV2
#define LPTIM_PRESCALER_DIV4
#define LPTIM_PRESCALER_DIV8
#define LPTIM_PRESCALER_DIV16
#define LPTIM_PRESCALER_DIV32
#define LPTIM_PRESCALER_DIV64
#define LPTIM_PRESCALER_DIV128
typedef enum
{
  HAL_LPTIM_CLK_SRC_DIV1
  HAL_LPTIM_CLK_SRC_DIV2
  HAL_LPTIM_CLK_SRC_DIV4
  HAL_LPTIM_CLK_SRC_DIV8
  HAL_LPTIM_CLK_SRC_DIV16
  HAL_LPTIM_CLK_SRC_DIV32
  HAL_LPTIM_CLK_SRC_DIV64
  HAL_LPTIM_CLK_SRC_DIV128
} hal_lptim_clk_src_presc_t;

Related concepts:


HAL LPTIM trigger sample time options constants

HAL1

HAL2



#define LPTIM_TRIGSAMPLETIME_DIRECTTRANSITION
#define LPTIM_TRIGSAMPLETIME_2TRANSITIONS
#define LPTIM_TRIGSAMPLETIME_4TRANSITIONS
#define LPTIM_TRIGSAMPLETIME_8TRANSITIONS
typedef enum
{
  HAL_LPTIM_FDIV1
  HAL_LPTIM_FDIV1_N2
  HAL_LPTIM_FDIV1_N4
  HAL_LPTIM_FDIV1_N8
} hal_lptim_filter_t;

Related concepts:


HAL LPTIM clock sample time options constants

HAL1

HAL2



#define LPTIM_CLOCKSAMPLETIME_DIRECTTRANSITION
#define LPTIM_CLOCKSAMPLETIME_2TRANSITIONS
#define LPTIM_CLOCKSAMPLETIME_4TRANSITIONS
#define LPTIM_CLOCKSAMPLETIME_8TRANSITIONS
typedef enum
{
  HAL_LPTIM_FDIV1
  HAL_LPTIM_FDIV1_N2
  HAL_LPTIM_FDIV1_N4
  HAL_LPTIM_FDIV1_N8
} hal_lptim_filter_t;

Related concepts:


HAL LPTIM trigger source options constants

HAL1

HAL2

#define LPTIM_TRIGSOURCE_SOFTWARE
#define LPTIM_TRIGSOURCE_0
#define LPTIM_TRIGSOURCE_1
#define LPTIM_TRIGSOURCE_2
#define LPTIM_TRIGSOURCE_3
#define LPTIM_TRIGSOURCE_4
#define LPTIM_TRIGSOURCE_5
#define LPTIM_TRIGSOURCE_6
#define LPTIM_TRIGSOURCE_7
#define LPTIM_TRIGSOURCE_8
#define LPTIM_TRIGSOURCE_9
#define LPTIM_TRIGSOURCE_10
#define LPTIM_TRIGSOURCE_11
#define LPTIM_TRIGSOURCE_12

In HAL2, this set of defines has been replaced by the enumeration hal_lptim_ext_trig_src_t.

The enumeration content is series-specific, representing the physical trigger sources such as GPIO, RTC Alarm A, TAMP1, and others.


HAL LPTIM interrupt identifiers constants

HAL1

HAL2

#define LPTIM_IT_ARRM
#define LPTIM_IT_ARROK
#define LPTIM_IT_CC1
#define LPTIM_IT_CC1O
#define LPTIM_IT_CC2
#define LPTIM_IT_CC2O
#define LPTIM_IT_CMP1OK
#define LPTIM_IT_CMP2OK
#define LPTIM_IT_DOWN
#define LPTIM_IT_EXTTRIG
#define LPTIM_IT_REPOK
#define LPTIM_IT_UP
#define LPTIM_IT_UPDATE
#define LPTIM_IT_CMPM
#define LPTIM_IT_CMPOK

In HAL1, those defines are used by the __HAL_LPTIM_ENABLE_IT() `` , ``__HAL_LPTIM_DISABLE_IT() and __HAL_LPTIM_GET_IT_SOURCE() macros.

In HAL2, these defines and macros have been removed. For direct interrupt management, users should utilize the corresponding LL functions.

For more details, refer to:


HAL LPTIM status flags constants

HAL1

HAL2

#define LPTIM_FLAG_ARRM
#define LPTIM_FLAG_ARROK
#define LPTIM_FLAG_CC1
#define LPTIM_FLAG_CC1O
#define LPTIM_FLAG_CC2
#define LPTIM_FLAG_CC2O
#define LPTIM_FLAG_CMP1OK
#define LPTIM_FLAG_CMP2OK
#define LPTIM_FLAG_CMPM
#define LPTIM_FLAG_CMPOK
#define LPTIM_FLAG_DIEROK
#define LPTIM_FLAG_DOWN
#define LPTIM_FLAG_EXTTRIG
#define LPTIM_FLAG_REPOK
#define LPTIM_FLAG_UP
#define LPTIM_FLAG_UPDATE

In HAL1, those defines are used by the __HAL_LPTIM_GET_FLAG() and __HAL_LPTIM_CLEAR_FLAG() macros.

In HAL2, these defines and macros have been removed, users should utilize the corresponding LL functions.

For more details, refer to:


HAL LPTIM update modes constants

HAL1

HAL2

#define LPTIM_UPDATE_ENDOFPERIOD
#define LPTIM_UPDATE_IMMEDIATE

In HAL2, the UpdateMode parameter has been removed from the initialization structure. Instead, users should call HAL_LPTIM_EnablePreload to enable update mode or HAL_LPTIM_DisablePreload to disable it.


HAL LPTIM dma capture/compare channels constants

HAL1

HAL2

#define LPTIM_DMA_UPDATE
#define LPTIM_DMA_CC1
#define LPTIM_DMA_CC2

In HAL1, those defines are used by the __HAL_LPTIM_ENABLE_DMA() and __HAL_LPTIM_DISABLE_DMA() macros.

In HAL2, these defines and macros have been removed, users should utilize the corresponding LL functions.

For more details, refer to:


HAL LPTIM clock source and counter source options constants

HAL1

HAL2

#define LPTIM_CLOCKSOURCE_APBCLOCK_LPOSC /* Internal clock source */
#define LPTIM_CLOCKSOURCE_ULPTIM         /* External clock source */

#define LPTIM_COUNTERSOURCE_INTERNAL
#define LPTIM_COUNTERSOURCE_EXTERNAL
  • In HAL1, the parameters CounterSource and clock are configured independently.

  • In HAL2, we have a single enumeration called hal_lptim_clk_src_t that covers all clocking and counting modes in a more structured way.